package com.wj.tool.common.utils.paging;

import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

public class QueryResults<T> implements Serializable {
    private static final long serialVersionUID = -5492796698773858925L;
    @Valid
    private Paging paging;
    private List<T> results;

    public QueryResults() {
    }

    public Paging getPaging() {
        return this.paging;
    }

    public void setPaging(Paging paging) {
        this.paging = paging;
    }

    public List<T> getResults() {
        return this.results;
    }

    public void setResults(List<T> results) {
        this.results = results;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o != null && this.getClass() == o.getClass()) {
            QueryResults<?> that = (QueryResults)o;
            return Objects.equals(this.paging, that.paging) && Objects.equals(this.results, that.results);
        } else {
            return false;
        }
    }

    public int hashCode() {
        return Objects.hash(new Object[]{this.paging, this.results});
    }

    public String toString() {
        return "QueryResults{paging=" + this.paging + ", results=" + this.results + '}';
    }
}